package com.ipbd.controller;

import com.ipbd.domain.FirstAction;
import com.ipbd.service.FirstActionService;
import com.ipbd.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/first")
@Slf4j
public class FirstActionController {

    @Autowired
    private FirstActionService firstActionService;

    /**
     * 填写并保存首次认知巩固
     * @param firstActions
     * @return
     */
    @PostMapping("/saveFirst")
    public R saveFirst(@RequestBody List<FirstAction> firstActions) {
        for (FirstAction firstAction : firstActions) {
            firstActionService.saveFirst(firstAction);
        }
        return R.ok();
    }

    /**
     * 查询首次认知巩固
     * @return
     */
    @GetMapping("/selectFirst")
    public R selectFirst() {
        return firstActionService.selectFirst();
    }
}
